package com.erps.config.Sys;

import com.alibaba.fastjson.JSON;
import com.erps.CommonUtils.ActionResult;
import com.erps.CommonUtils.AppConfig;
import com.erps.CommonUtils.StringEx;
import com.erps.CommonUtils.ValueType;
import com.erps.sys.rest.ErspSysUserRest;
import com.hmkj.entity.ErspSysUser;
import com.jfinal.core.Controller;

public class SysUserRestController extends Controller {
	public void del() {

	}

	public void check() {
		String cID = StringEx.getStr(this.getPara("id"));
		String cTypeID = StringEx.getStr(this.getPara("type"));
		int iCode = ValueType.FAILURE;
		ErspSysUserRest vRest = new ErspSysUserRest();
		if (!StringEx.isEmpty(cID)) {
			ErspSysUser rs = vRest.FindOne(cID);
			if (rs != null) {
				iCode = vRest.Check(rs, cTypeID, StringEx.getStr(getSessionAttr(AppConfig.SESSION_USERID)));
			}
		}
		ActionResult ret;
		if (iCode > 0)
			ret = ActionResult.Valid(ValueType.SUCCESS);
		else
			ret = ActionResult.Valid(ValueType.FAILURE);
		renderJson(JSON.toJSONString(ret));
	}
}
